package com.xxx.td;

import com.sun.org.apache.bcel.internal.generic.NEW;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/30 16:14
 * @Copyright 博为峰
 */
public class Test02 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask = new FutureTask<>(new CallableDemo());
        new Thread(futureTask).start();
        final String s = futureTask.get();//阻塞
        System.out.println(s);
        System.out.println(Thread.currentThread().getName());
    }
}
